/* Copyright (c) 2012-2013, Xiaomi corporation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */
#include <linux/mfd/pm8xxx/pm8921-bms.h>

static struct single_row_lut fcc_temp = {
	.x	= {-20, 0, 5, 10, 15, 20, 25, 40, 60},
	.y	= {1957, 1964, 1956, 1955, 1954, 1954, 1963, 1960, 1953},
	.cols	= 9
};

static struct single_row_lut fcc_sf = {
	.x	= {0},
	.y	= {100},
	.cols	= 1
};

static struct sf_lut rbatt_sf = { 
        .rows           = 28, 
        .cols           = 9,
        /* row_entries are temperature */
        .row_entries	= {-20, 0, 5, 10, 15, 20, 25, 40, 60},
        .percent        = {100, 95, 90, 85, 80, 75, 70, 65, 60, 55, 50, 45, 40, 35, 30, 25, 20, 15, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1},
        .sf		= {
{631,267,231,172,136,113,100,83,78},
{679,277,236,182,144,119,106,87,80},
{714,280,240,189,150,124,109,90,82},
{743,283,244,194,154,127,112,92,84},
{773,288,246,199,158,130,115,94,86},
{812,293,249,203,161,133,116,95,87},
{862,298,251,199,164,135,118,95,88},
{923,303,255,201,158,130,118,96,88},
{998,308,259,205,160,130,110,87,81},
{1081,313,264,211,165,132,112,87,79},
{1181,320,271,218,172,138,117,89,82},
{1291,328,280,229,181,145,123,92,85},
{1424,341,289,240,192,155,130,96,87},
{1583,361,298,251,203,165,138,100,87},
{1785,386,307,261,214,174,145,104,84},
{2043,417,313,266,221,180,149,103,86},
{2403,461,320,268,223,180,147,100,85},
{2977,528,358,295,246,198,160,104,86},
{1340,392,322,267,221,180,148,100,85},
{1423,401,330,274,226,184,151,102,86},
{1534,411,338,280,232,189,155,104,87},
{1662,423,346,287,237,192,158,105,87},
{1827,438,356,295,243,197,161,105,85},
{2041,463,364,301,246,198,161,103,85},
{2338,494,374,307,252,201,165,105,88},
{2765,543,394,321,263,211,174,111,92},
{3421,614,438,337,278,224,189,118,94},
{4637,719,517,388,305,246,205,125,100},

	 }
};

static struct pc_temp_ocv_lut pc_temp_ocv = {
	.rows		= 29,
	.cols		= 9,
	.temp		= {-20, 0, 5, 10, 15, 20, 25, 40, 60},
	.percent	= {100, 95, 90, 85, 80, 75, 70, 65, 60, 55, 50, 45, 40, 35, 30, 25, 20, 15, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
	.ocv		= {
				{4180, 4178, 4178, 4178, 4178, 4177, 4175, 4172, 4166},
				{4110, 4116, 4118, 4119, 4119, 4120, 4117, 4116, 4113},
				{4048, 4070, 4074, 4076, 4076, 4076, 4073, 4072, 4069},
				{3997, 4020, 4029, 4032, 4033, 4034, 4030, 4031, 4028},
				{3954, 3973, 3985, 3991, 3993, 3993, 3991, 3992, 3991},
				{3917, 3938, 3946, 3959, 3960, 3961, 3959, 3959, 3957},
				{3884, 3907, 3913, 3929, 3931, 3932, 3929, 3929, 3926},
				{3856, 3878, 3882, 3887, 3902, 3903, 3902, 3901, 3899},
				{3832, 3852, 3855, 3856, 3859, 3862, 3872, 3874, 3872},
				{3811, 3828, 3831, 3831, 3831, 3832, 3831, 3833, 3834},
				{3791, 3805, 3809, 3810, 3810, 3810, 3809, 3809, 3808},
				{3774, 3786, 3793, 3793, 3794, 3794, 3792, 3792, 3792},
				{3757, 3768, 3782, 3782, 3782, 3782, 3781, 3778, 3779},
				{3742, 3753, 3774, 3774, 3773, 3774, 3773, 3769, 3768},
				{3727, 3743, 3765, 3767, 3766, 3766, 3765, 3762, 3755},
				{3713, 3733, 3754, 3758, 3757, 3757, 3755, 3751, 3735},
				{3696, 3723, 3734, 3735, 3736, 3735, 3733, 3726, 3713},
				{3673, 3710, 3705, 3703, 3701, 3700, 3699, 3691, 3680},
				{3642, 3689, 3688, 3685, 3682, 3679, 3678, 3671, 3661},
				{3632, 3683, 3684, 3682, 3679, 3678, 3676, 3670, 3660},
				{3622, 3677, 3680, 3679, 3677, 3675, 3673, 3667, 3658},
				{3609, 3669, 3675, 3674, 3672, 3671, 3669, 3663, 3653},
				{3593, 3656, 3663, 3663, 3661, 3660, 3657, 3650, 3638},
				{3573, 3631, 3639, 3638, 3635, 3632, 3627, 3617, 3603},
				{3545, 3591, 3597, 3594, 3590, 3585, 3581, 3572, 3560},
				{3506, 3536, 3539, 3534, 3529, 3526, 3522, 3518, 3509},
				{3448, 3458, 3460, 3457, 3455, 3454, 3453, 3453, 3445},
				{3359, 3349, 3360, 3360, 3363, 3365, 3362, 3360, 3352},
				{3200, 3200, 3200, 3200, 3200, 3200, 3200, 3200, 3200}
	}
};

struct pm8921_bms_battery_data lg_1900_data = {
	.fcc			= 1930,
	.fcc_temp_lut		= &fcc_temp,
	.fcc_sf_lut		= &fcc_sf,
	.pc_temp_ocv_lut	= &pc_temp_ocv,
	.rbatt_sf_lut		= &rbatt_sf,
	.default_rbatt_mohm	= 144,

};
